package br.com.conhecimento.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.springframework.stereotype.Component;

/**
 * Modelo de Dados de Perfil.
 * @author Luis Garcia
 */
@Entity
@Table(name = "tb_perfil")
@Component("perfil")
public class Perfil extends ModeloBase {

	/** Serial Version. */
	private static final long serialVersionUID = 1L;
	
	@Column(name="DESCRICAO")
	private String descricao;
	
	@ManyToMany
	@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE})
	@JoinColumn(name="ID_ACESSO", referencedColumnName="ID")
	private List<Acesso> acessos;

	public String getDescricao() {
		return descricao;
	}

	public void setDescricao(String descricao) {
		this.descricao = descricao;
	}

	public List<Acesso> getAcessos() {
		return acessos;
	}

	public void setAcessos(List<Acesso> acessos) {
		this.acessos = acessos;
	}

	@Override
	public String toString(){
		return "[Perfil: "+this.getId()+"]";
	}

}